/*!
\file Edge.cpp
\brief Contains implementation of Edge.
\ingroup Graph
*/

#include"Edge.h"

Edge::Edge( Node from, Node to, QString label, int identifier ): m_from(from), m_to(to), m_label(label){
	m_identifier = identifier;
}

Edge::Edge( const Edge &other ): m_from(other.from()), m_to(other.to()), m_label(other.label()){
	m_identifier = other.identifier();
}

Node Edge::from()const{
	return m_from;
}

Node Edge::to()const{
	return m_to;
}

QString Edge::label()const{
	return m_label;
}

QString Edge::_toDOT( bool isDirected )const{

	return QString().setNum( m_from.identifier() ) 
		+ (isDirected?QString(" -> "):QString(" -- ")) 
		+ QString().setNum(m_to.identifier()) 
		+ QString( "[label=\"" ) + QString().setNum(m_identifier)+QString(":")+m_label + QString( "\"]" )
		+ QString(";");
}

QString Edge::toString()const{
	return QString("Edge(").append(QString().setNum(m_from.identifier())).append("--").append(QString().setNum(m_to.identifier())).append(")");
}
